<template>
	<view class="content">
		<view class="topBg">
			<u-navbar :is-back="true" :background="background" :border-bottom="false" back-icon-color="#fff">
				<view style="display: flex;justify-content: center;width: 100%;align-items: center;">
				</view>
			</u-navbar>
			<view class="banner">
				<view style="display: flex;align-items: center;justify-content: center;flex-direction: column;padding-bottom: 20rpx;">
					<!-- <u-image width="106rpx" src="https://img.koalalf.com/center/order-fahuo.png" mode="widthFix"></u-image> -->
					<text style="color: #fff;font-size: 36rpx;margin-top: 20rpx;">待收货</text>
				</view>
			</view>
		</view>
		<view class="wuliu-content" v-if="order && order.express" @click="openPage('pages/orders/wuliuDetail', {data:JSON.stringify(order.express)})">
			<u-icon name="car-fill" color="#d5d5d5" size="48"></u-icon>
			<view class="wrapper">
				<view class="u-box">
					<text class="name">{{order.express.express_info[0].context}}</text>
				</view>
				<view class="address-box">
					<text class="address">{{order.express.express_info[0].time}}</text>
				</view>
			</view>
		</view>
		<u-line color="#f5f5f5" length="100%"></u-line>
		<view class="address-content">
			<u-icon name="map-fill" color="#d5d5d5" size="48"></u-icon>
			<view class="wrapper">
				<view class="u-box">
					<text class="name">{{order.address.name}}</text>
					<text class="mobile">{{order.address.mobile}}</text>
				</view>
				<view class="address-box">
					<text class="address">{{order.address.address}} {{order.address.address_name}} {{order.address.area}}</text>
				</view>
			</view>
		</view>
		
		<view class="car-list">
			<view class="list" v-for="(item, index) in order.order_product" :key="index">
				<image class="car-img" :src="item.product.pict_url" mode="aspectFill"></image>
				<view class="car-mes ">
					<view class="mes-box">
						<view class="g-name line2">{{item.product.short_title}}</view>
						<view class="gz-box"><text>{{item.product_sku_attr}}</text></view>
						<view class="price-change-num">
							<view class="price">
								<price :price="item.product_price" />
							</view>
							<view class="num-box">
								<text style="font-size: 24rpx;">X</text>
								<view>{{item.quantity}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="order-info-content">
			<view class="order-info-content-item">
				<view class="order-info-content-item-left">订单编号:</view>
				<view class="order-info-content-item-right">{{order.number}}</view>
			</view>
			<view class="order-info-content-item">
				<view class="order-info-content-item-left">下单时间:</view>
				<view class="order-info-content-item-right">{{order.create_time}}</view>
			</view>
			<view class="order-info-content-item">
				<view class="order-info-content-item-left">支付方式:</view>
				<view class="order-info-content-item-right">{{order.pay_type}}</view>
			</view>
			<view class="order-info-content-item">
				<view class="order-info-content-item-left">支付时间:</view>
				<view class="order-info-content-item-right">{{order.pay_time}}</view>
			</view>
			<view class="order-info-content-item" v-if="order && order.express">
				<view class="order-info-content-item-left">配送方式:</view>
				<view class="order-info-content-item-right">{{order.express.express_name}}</view>
			</view>
		</view>
		
		<view class="order-goods-info-content">
			<view class="order-goods-info-content-item">
				<view class="order-goods-info-content-item-left">商品总额</view>
				<view class="order-goods-info-content-item-right">￥{{order.goods_price}}</view>
			</view>
			<view class="order-goods-info-content-item">
				<view class="order-goods-info-content-item-left">运费</view>
				<view class="order-goods-info-content-item-right">+￥0.00</view>
			</view>
			<view class="order-goods-info-content-item">
				<view class="order-goods-info-content-item-left">促销立减</view>
				<view class="order-goods-info-content-item-right">-￥0.00</view>
			</view>
			<view class="order-goods-info-content-item">
				<view class="order-goods-info-content-item-left">商品优惠</view>
				<view class="order-goods-info-content-item-right">-￥0.00</view>
			</view>
			<view class="order-goods-info-content-item">
				<view class="order-goods-info-content-item-left"></view>
				
				<view class="order-goods-info-content-item-right" style="display: flex;flex-direction: row;">
					<view style="color: #151515;">实付金额：</view>
					<view>￥{{order.pay_price}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import price from '../../components/price.vue'
	export default {
		components: {
			price
		},
		onLoad({id}) {
			let that = this;
			this.$u.api.orderDetail({order_id:id}).then(res => {
				that.order = res
			})
		},
		data() {
			return {
				background: {
					backgroundImage: 'linear-gradient(to left, rgba(255, 0, 60, 1) , #FF375C)'
				},
				order:null
			}
		},
		methods: {
			openPage(path, params) {
				this.$u.route({
					url: path,
					params
				})
			},
		}
	}
</script>

<style lang='scss' scoped>
	.content {
		background-color: #F5F5F5;
		min-height: 100vh;
		
		.topBg {
			background-image: linear-gradient(to left, rgba(255, 0, 60, 1), #FF375C);
			width: 100%;
			padding-bottom: 20rpx;
		}
		
		.order-goods-info-content{
			background-color: #fff;
			padding: 20rpx;
			margin-top: 2rpx;
			.order-goods-info-content-item{
				display: flex;
				align-items: center;
				flex-direction: row;
				justify-content: space-between;
				height: 70rpx;
				.order-goods-info-content-item-left{
					color: #999;
				}
				.order-goods-info-content-item-right{
					color: #f2270c;
					font-weight: bold;
				}
			}
		}
		
		.order-info-content{
			background-color: #fff;
			padding: 20rpx;
			margin-top: 20rpx;
			.order-info-content-item{
				display: flex;
				align-items: center;
				flex-direction: row;
				height: 70rpx;
				.order-info-content-item-left{
					color: #999;
					min-width: 140rpx;
				}
				.order-info-content-item-right{
					color: #151515;
				}
			}
		}

		.address-content {
			display: flex;
			align-items: center;
			padding: 20upx 30upx;
			background: #fff;
			position: relative;

			.wrapper {
				display: flex;
				flex-direction: column;
				flex: 1;
				margin-left: 20rpx;

				.address-box {
					display: flex;
					align-items: baseline;
					margin-top: 10rpx;

					.tag {
						font-size: 20upx;
						color: $base-color;
						margin-right: 10upx;
						background: #fffafb;
						border: 1px solid #ffb4c7;
						border-radius: 4upx;
						padding: 4upx 10upx;
						line-height: 1;
						width: 80rpx;
						text-align: center;
						height: 32rpx;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					.address {
						font-size: 24rpx;
						color: #999;
						line-height: 40rpx;
					}
				}

				.u-box {
					font-size: 28upx;
					color: #333;
					margin-top: 16upx;
					font-weight: bold;

					.name {
						margin-right: 20upx;
					}
				}
			}
		}
		
		.wuliu-content {
			display: flex;
			align-items: center;
			padding: 20upx 30upx;
			background: #fff;
			position: relative;
			margin-top: 20rpx;
		
			.wrapper {
				display: flex;
				flex-direction: column;
				flex: 1;
				margin-left: 20rpx;
		
				.address-box {
					display: flex;
					align-items: baseline;
					margin-top: 10rpx;
		
					.tag {
						font-size: 20upx;
						color: $base-color;
						margin-right: 10upx;
						background: #fffafb;
						border: 1px solid #ffb4c7;
						border-radius: 4upx;
						padding: 4upx 10upx;
						line-height: 1;
						width: 80rpx;
						text-align: center;
						height: 32rpx;
						display: flex;
						justify-content: center;
						align-items: center;
					}
		
					.address {
						font-size: 24rpx;
						color: #999;
						line-height: 40rpx;
					}
				}
		
				.u-box {
					font-size: 28upx;
					color: #333;
					margin-top: 16upx;
					font-weight: bold;
		
					.name {
						margin-right: 20upx;
					}
				}
			}
		}
		
		.car-list {
			width: 100%;
			margin-top: 20rpx;
		}
		
		.car-list .list {
			width: 100%;
			padding: 20rpx;
			display: flex;
			background: #FFFFFF;
			border-radius: 10rpx;
			border-bottom: 1px solid #F5F5F5;
		}
		
		.car-list .list:nth-child(1) {
			border-top-left-radius: 0;
			border-top-right-radius: 0;
		}
		
		.car-list .list:nth-last-child(1) {
			margin: 0;
		}
		
		.car-list .list .btn {
			width: 70rpx;
			height: 190rpx;
		}
		
		.car-list .list .btn .iconfont {
			color: #db422c;
			font-size: 38rpx;
		}
		
		.car-list .list .car-img {
			width: 190rpx;
			height: 190rpx;
			border-radius: 10rpx;
		}
		
		.car-list .list .car-mes {
			flex: 1;
			margin-left: 20rpx;
		}
		
		.car-list .g-name {
			font-size: 28rpx;
			color: #2a2a2a;
			height: 84rpx;
			overflow: hidden;
		}
		
		.car-list .mes-box {
			width: 100%;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			height: 100%;
		}
		
		.car-list .gz-box {
			font-size: 26rpx;
			color: #999999;
			margin: 10rpx 0;
		}
		
		.car-list .mes-box .price {
			color: #ff5621;
			font-weight: bold;
			font-size: 24rpx;
		}
		
		.car-list .mes-box .yj-price {
			font-size: 36rpx;
		}
		
		.car-list .price .num {
			color: #2a2a2a;
			font-size: 28rpx;
			font-weight: normal;
			float: right;
		}
		
		.car-list .num-box {
			display: flex;
			flex-direction: row;
			color: #999999;
			align-items: center;
		}
		
		.car-list .num-box .iconfont {
			font-size: 50rpx;
			color: #999999;
		}
		
		.car-list .num-box view {
			text-align: center;
			height: 50rpx;
			line-height: 50rpx;
			font-size: 30rpx;
			color: #2A2A2A;
			margin: 0 10rpx;
			color: #999999;
		}
		.price-change-num {
			display: flex;
			align-items: center;
			justify-content: space-between;
			color: #999;
		}
	}
</style>
